package com.sjlh.centurylianhua.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sjlh.centurylianhua.entity.LossesLog;
import com.sjlh.centurylianhua.entity.Product;
import com.sjlh.centurylianhua.entity.ProductType;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ProductMapper extends BaseMapper<Product> {

    /**
     *查询内容：
     * product表的所有，
     * producttype 表的 name 起别名为 typeName 以便自动赋值 product 类中的 typeName 属性
     * ${ew.customSqlSegment} 传递wrapper条件的固定写法
     * */
    //分页+查询
    @Select("select product.*, producttype.name typeName from product," +
            "producttype"+" ${ew.customSqlSegment} ")
    List<Product> getInfoPage(Page<Product> page, @Param("ew") QueryWrapper<Product> wrapper);

    //不执行分页查询
    @Select("select product.*, producttype.name typeName from product,producttype"+" ${ew.customSqlSegment} ")
    List<Product> getInfo(@Param("ew") QueryWrapper<Product> wrapper);
}
